<template>
  <Dialog v-model="dialogVisible" title="题库管理" width="800px">
    <el-form ref="formRef" :model="formData" label-width="100px">
      <el-form-item label="题目类型">
        <el-select v-model="formData.questionType" placeholder="请选择题目类型">
          <el-option label="单选题" value="1" />
          <el-option label="多选题" value="2" />
          <el-option label="判断题" value="3" />
          <el-option label="填空题" value="4" />
        </el-select>
      </el-form-item>
      <el-form-item label="题目内容">
        <el-input v-model="formData.questionContent" type="textarea" :rows="4" placeholder="请输入题目内容" />
      </el-form-item>
      <el-form-item label="难度等级">
        <el-select v-model="formData.difficultyLevel" placeholder="请选择难度等级">
          <el-option label="简单" value="1" />
          <el-option label="中等" value="2" />
          <el-option label="困难" value="3" />
        </el-select>
      </el-form-item>
      <el-form-item label="分值">
        <el-input-number v-model="formData.score" :min="1" :max="100" placeholder="请输入分值" />
      </el-form-item>
    </el-form>
    <template #footer>
      <el-button @click="dialogVisible = false">取 消</el-button>
      <el-button type="primary" @click="submitForm">确 定</el-button>
    </template>
  </Dialog>
</template>

<script setup lang="ts">
import { ref } from 'vue'

const dialogVisible = ref(false)
const formRef = ref()
const formData = ref({
  questionType: '',
  questionContent: '',
  difficultyLevel: '',
  score: 1
})

const open = () => {
  dialogVisible.value = true
}

const submitForm = () => {
  // TODO: 实现提交逻辑
  dialogVisible.value = false
}

defineExpose({ open })
</script> 